package com.shell.guard.config.oauth;

import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;

import java.util.Properties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LoginConfig {
	@Bean
	public DefaultKaptcha captchaProducer() {
		DefaultKaptcha kapt = new DefaultKaptcha();
		Properties properties = new Properties();
		properties.setProperty("kaptcha.image.width", "160");
		properties.setProperty("kaptcha.image.height", "72");
		properties.setProperty("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise");
		properties.setProperty("kaptcha.textproducer.char.string", "0123456789");
		properties.setProperty("kaptcha.textproducer.char.length", "4");
		properties.setProperty("kaptcha.textproducer.font.size", "40");
		properties.setProperty("kaptcha.border", "no");
		Config config = new Config(properties);
		kapt.setConfig(config);
		return kapt;
	}
}
